package com.yanqu.road.server.cmd.zhaoshang;

import com.yanqu.road.pb.zhaoshang.ZhaoShangProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.zhaoshang.ZsMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.Protocol;


@Cmd(code = Protocol.S_ZS_PROJECT_NOTICE_LIST, desc = "项目公告列表")
public class ZsProjectNoticeListCmd extends AbstractCommand {

    private long projectId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ZhaoShangProto.ZsProjectNoticeReqMsg reqMsg = ZhaoShangProto.ZsProjectNoticeReqMsg.parseFrom(packet.getBytes());
        projectId = reqMsg.getProjectId();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

        ZhaoShangProto.CrossZsProjectNoticeReqMsg.Builder  crossReqMsg = ZhaoShangProto.CrossZsProjectNoticeReqMsg.newBuilder();
        crossReqMsg.setProjectId(projectId);
        crossReqMsg.setGroupId(ZsMgr.getGroupId(GameServer.getInstance().getServerId()));  //分组id
        player.sendPacket(CrossProtocol.C2_ZHAO_SHANG_PROJECT_NOTICE_LIST, crossReqMsg);

    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
